package com.softkey;

public class jsyunew3
{
	public static native int GetVersion(String InPath);
	public static native int GetVersionEx(String InPath);

	public static native long GetID_1(String InPath);
	public static native long GetID_2(String InPath);
	public static native long get_LastError();

	public static native String FindPort(int start);
	public static native String FindPort_2(int start,long in_data,long verf_data);
	public static native String FindPort_3(int start, long in_data, long verf_data);

	public static native int SetReadPassword(String W_hkey, String W_lkey, String new_hkey, String new_lkey, String InPath);
	public static native int SetWritePassword(String W_hkey, String W_lkey, String new_hkey, String new_lkey, String InPath);
	public static native int sWriteEx_New(int in_data, String KeyPath);
	public static native int sWrite_2Ex_New(int in_data, String KeyPath);
	public static native int sWriteEx(int InData, String InPath);
	public static native int sWrite_2Ex(int InData, String InPath);
	public static native long sRead(String InPath);
	public static native int sWrite(long InData,String InPath);
	public static native int sWrite_2(long InData,String InPath);

	public static native int YReadEx(short Address, short len, String HKey, String LKey, String InPath);
	public static native int YRead(short Address, String HKey, String LKey, String InPath);

	public static native short GetBuf(int pos);

	public static native int YWriteEx(short Address, short len, String HKey, String LKey, String InPath);

	public static native int YWrite(short inData, short Address, String HKey, String LKey, String InPath);
	public static native int SetBuf(int pos, short Data);
	public static native String NewReadString(int Address, int len, String HKey, String LKey, String InPath);

	public static native int NewWriteString(String InString, int Address, String HKey, String LKey, String InPath);

	public static native String YReadString(short Address, short len, String HKey, String LKey,String InPath);
	public static native int YWriteString(String InString, short Address, String HKey, String LKey,String InPath);

	public static native int SetCal_2(String Key, String InPath);

	public static native String EncString(String InString, String InPath);

	public static native int Cal(String InPath);

	public static native int SetCal_New(String Key, String InPath);

	public static native String EncString_New(String InString, String InPath);

	public static native int Cal_New(String InPath);

	public static native String DecString(String InString, String Key);

	public static native int SetEncBuf(int pos, short Data);
	public static native short GetEncBuf(int pos);

	public static native String GetPubKeyX(String InPath);
	public static native String GetPubKeyY(String InPath);
	public static native String get_GenPriKey();
	public static native String get_GenPubKeyX();
	public static native String get_GenPubKeyY();
	public static native int StarGenKeyPair(String InPath);
	public static native String SM2_EncString(String InString,String InPath);
	public static native String SM2_DecString(String InString,String Pin,String InPath);
	public static native int YtSetPin(String OldPin,String NewPin,String InPath);
	public static native String YtSign(String msg,String Pin,String InPath);
	public static native boolean YtVerfiy(String id,String msg,String PubKeyX,String  PubKeyY,String VerfiySign,String InPath);
	public static native int Set_SM2_KeyPair(String PriKey,String PubKeyX,String PubKeyY,String sm2UserName,String InPath);
	public static native String GetSm2UserName(String InPath);
	public static native String GetChipID(String InPath);
	public static native String FindU(int start);
	public static native String FindU_3(int start,int in_data,int verf_data);
	public static native String FindU_2(int start,int in_data,int verf_data);
	public static native int SetUReadOnly(String InPath);
	public static native int SetHidOnly(boolean IsHidOnly,String InPath);
	public static native boolean IsUReadOnly(String InPath);

	public static native int SetID(String Seed, String InPath);
	public static native int SetCal(String Old_hkey, String Old_lkey, String new_hkey, String new_lkey, String InPath);
	public static native String GetProduceDate(String InPath);

	public static native int ReSet(String InPath);

	public static native String FindD8(int pos,String VerfCode);
	public static native int GetFuncVer(String InPath);

	public static native int  DownLoadBinFile(boolean bIsEnc,String BinFile,String InPath);
	public static native int  DownLoadData(boolean bIsEnc,byte[] Buf,int BufLen,String InPath);
	public static native String  EncBinFile(String BinFile,String Key);
	public static native int RunFuntion(String FunctionName,String InPath );
	public static native int ContinuRun(String InPath);

	public static native int  SetVar(byte []Buf,int MemBeginPos,int BufLen,String InPath);
	public static native byte[] GetVar(int MemBeginPos,int OutBufLen,String InPath);

	public static native String  SetDownLodKey(String OldKey,String NewKey,String InPath);
	public static native int  OpenKey(String VerfCode,String InPath);
	public static native int  CloseKey(String InPath);


	public static native byte [] GetApiParam(int OutLen,String InPath);
	public static native int  SetApiParam(byte []Buf,int InLen,String InPath);

	public static native int WriteEprom(byte[]InBuf,int Addr,int len,String HKey,String LKey,String InPath);
	public static native byte [] ReadEprom(int Addr,int len,String HKey,String LKey,String InPath);
	public static native int NewSetReadPassword(String OldWriteHKey,String OldWriteLKey,String NewHKey,String NewLKey,String InPath);
	public static native int NewSetWritePassword(String OldWriteHKey,String OldWriteLKey,String NewHKey,String NewLKey,String InPath);

	public static native int GetLimitYear(String InPath);
	public static native int GetLimitMonth(String InPath);
	public static native int GetLimitDay(String InPath);
	public static native int GetUserID(String InPath);
	public static native int GetLeaveNumber(String InPath);
	public static native int GetLeaveDays(String CurDate,String InPath);
	public static native int CheckBind(boolean bIsAdd,String MacAddr,String InPath);
	public static native int CheckNumber(String InPath);
	public static native int CheckDate(String InDate,String InPath);
	public static native int UpdateAuth(byte Flag,String Auth,String InPath);
	public static native int DateAuth(int CurYear,byte CurMonth,byte CurDay,
		int LimitYear,byte LimitMonth,byte LimitDay,int UserID,
		String Key,String InPath);
	public static native int NumberAuth(int Number,int UserID,String Key,String InPath);
	public static native int BindAuth(boolean bReBind,int BindCount,int UserID,String Key,String InPath);
	public static native int GetLimitBindCount(String InPath);
	public static native int GetAlreadyBindCoun(String InPath);
	public static native String MakeBindAuth(boolean bReBind, int BindCount, int UserID, String Key);
	public static native String MakeNumberAuth(int Number,int UserID,String Key);
	public static native String MakeDateAuth(int CurYear,byte CurMonth,byte CurDay,
		int LimitYear,byte LimitMonth,byte LimitDay,int UserID,
		String Key);
	public static native int CloseUsbHandle(String InPath);
	static
     {
		 String DllName;
		 String JdkBit=System.getProperty("sun.arch.data.model");
		if(JdkBit.equals("32"))
		{
			DllName="Jsyunew3";

		}
		else
		{
			DllName = "Jsyunew3_64";

		}
		try
        {

			 System.loadLibrary(DllName);
//			 System.load("C:\\Users\\84240\\Desktop\\sample-java\\dll\\Jsyunew3_64.dll");
		}
		catch (UnsatisfiedLinkError e)
		{
			System.err.println("Can//t find library:" + DllName);
			System.exit(-1);
		}
     }

}
